package com.yswee.mallnavi.entity.common;

import com.google.gson.annotations.SerializedName;
import com.yswee.framework.utils.StringUtils;
import com.yswee.mallnavi.context.ContextConstant;
import com.yswee.mallnavi.entity.BaseEntity;

public class VersionEntity extends BaseEntity {

    private static final long serialVersionUID = 8536080945163059784L;

    public String version;
    @SerializedName("apkUrl")
    public String url;

    public boolean hasNewVersion() {
        if (!StringUtils.isEmpty(version)) {
            if (version.toLowerCase().startsWith("v")) {
                version = version.substring(1);
            }
            return StringUtils.compareVersion(ContextConstant.VERSION, version) > 0;
        }
        return false;
    }

}
